package com.ehi.@appName@.resource;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ehi.common.jersey.status.ResponseBuilder;

import com.ehi.@appName@.domain.Carrier;
import com.ehi.@appName@.service.CarrierService;

@Component
@Path("/carrier")
public class CarrierResource {

    private static final Logger LOG = LoggerFactory.getLogger(CarrierResource.class);

    @Autowired
    private CarrierService carrierService;

    @GET
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getQuestion(@PathParam("id") Long id) {
        Carrier question = carrierService.getById(id);
        if (question == null) {
            return ResponseBuilder.notFoundObject();
        }
        return ResponseBuilder.ok(question);
    }

}
